﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace GenerateDiagram
{
    public class SqlColumnType : AbstractColumnType
    {

        public override string ConvertType()
        {
            switch (this.DataType)
            {
                case "image":
                case "binary":
                case "varbinary":
                case "timespamp":
                    return "byte[]";

                case "tinyint":
                    return "byte";

                case "date":
                case "time":
                case "datetime":
                case "smalldatetime":
                    return "DateTime";

                case "bit":
                    return "bool";

                case "smallint":
                    return "short";                
                    
                case "int":
                    return "int";
             
                case "real":
                    return "float";

                
                case "float":
                    return "double";

                case "decimal":
                case "money":
                case "numberic":
                case "smallmoney":
                    return "decimal";

                case "bigint":
                    return "long";

                case "nvarchar":
                case "ntext":
                case "text":
                case "varchar":
                case "xml":
                    return "string";

                case "uniqueidentifier":
                    return "Guid";

                default:
                    return "string";
                    
            }
        }

        public override string DbType
        {
            get
            {
                return ConvertType();
            }
            set
            {
                this.DbType = value;
            }
        }
    }
}

